<%layout("/eova/layout/default.html",{'title' : '修改' + object.name }){%>
<body>
<#form id="${'updateForm' + object.code}" name="${'updateForm' + object.code}" items="${fields}" isUpdate="true" />

<script type="text/javascript">
var $form = $('#updateForm${object.code}');

var submitNow = function($dialog, $grid, $pjq) {
    var url = "/form/doUpdate/${object.code}";
    $.post(url, sy.serializeObject($form), function(result) {
        if (result.success) {
        	$.slideMsg("修改${object.name}成功！", $pjq);
            $grid.datagrid('load');
            $dialog.dialog('destroy');
        } else {
            console.log('失败');
            $pjq.messager.alert('提示', result.msg, 'error');
        }
    }, 'json');
};
var submitForm = function($dialog, $grid, $pjq) {
    // nice validator
    $form.isValid(function(isValied){
        if(isValied){
            submitNow($dialog, $grid, $pjq);
        }
    });
};
</script>
</body>
<%}%>
